package com.qs.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 训练项目
 */
public enum TrainingSession {
	GFZ("GFZ", "挂风障操作"), MBMF("MBMF", "建造木板密封墙操作"), ZMF("ZMF", "建造砖密封墙操作"), JMP(
			"JMP", "架木棚操作"), TFJ("TFJ", "安装局部通风机和接风筒操作"), MHJ("MHJ",
			"安装高倍数泡沫灭火机操作"), DXQT("DXQT", "安装惰性气体发生装置或惰泡装置操作"), JSG("JSG",
			"安装接水管操作"), FOURH("FOURH", "4h正压呼吸器席位操作"), O2("O2", "氧气呼吸器校验仪操作"), SUSHENGQI(
			"SUSHENGQI", "自动苏生器操作"), WASI("WASI", "瓦斯鉴定器操作"), CO("CO",
			"一氧化碳鉴定器操作"), OTHER("OTHER", "其他仪器操作"), ZHENGYAO2("ZHENGYAO2",
			"正压氧气呼吸器故障操作"), ZHTZ("ZHTZ", "综合体质训练"), WMPY("WMPY", "万米配氧训练"), GWNBY(
			"GWNBY", "高温浓烟训练");

	private String value;
	private String title;

	TrainingSession(String value, String title) {
		this.value = value;
		this.title = title;
	}

	/**
	 * 获取枚举值
	 * 
	 * @return 返回枚举值
	 */
	public String value() {
		return this.value;
	}

	/**
	 * 获取枚举标题
	 * 
	 * @return 返回枚举的标题
	 */
	public String title() {
		return this.title;
	}

	private static Map<String, TrainingSession> titlefinder;
	static {
		titlefinder = new HashMap<String, TrainingSession>();
		for (TrainingSession item : TrainingSession.values())
			titlefinder.put(item.title(), item);

	}

	private static Map<String, TrainingSession> valuefinder;
	static {
		valuefinder = new HashMap<String, TrainingSession>();
		for (TrainingSession item : TrainingSession.values())
			valuefinder.put(item.value(), item);

	}

	/**
	 * 按照枚举标题查找枚举值
	 * 
	 * @param value
	 *            数据类型值对象
	 * @return 返回枚举值对象
	 */
	public static TrainingSession titleOf(String title) {
		return titlefinder.get(title);
	}

	public static TrainingSession[] getMembers() {
		return new TrainingSession[] { GFZ, MBMF, ZMF, JMP, TFJ, MHJ, DXQT,
				JSG, FOURH, O2, SUSHENGQI, WASI, CO, OTHER, ZHENGYAO2, ZHTZ,
				WMPY, GWNBY };
	}
}
